<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a="http://richfaces.org/a4j"
	template="/layout/template-base.xhtml" contentType="text/html"
	markupType="xhtml">

	<ui:define name="content">
		
		<ui:include src="/user.xhtml" />
		
		<h:form>
			<s:decorate template="/layout/content.xhtml">
				<a:outputPanel rendered="#{perfilesAction.listarPerfiles}">
					<h:outputText value="#{messages['profiles.table.title']}"
						styleClass="title color-orange" />
					<rich:panel styleClass="panel border-color-orange">
						<rich:dataTable columnClasses="data-table-cell" id="profilesTable"
							value="#{perfilesAction.perfiles}" styleClass="data-table"
							var="item" rows="10">
							<rich:column filterBy="#{item.nombre}">
								<f:facet name="header">
									<h:outputText value="#{messages['profiles.table.name']}" />
								</f:facet>
								<h:outputText value="#{item.nombre}" />
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="#{messages['profiles.table.registration.date']}" />
								</f:facet>
								<h:outputText value="#{item.alta}">
									<s:convertDateTime pattern="dd/MM/yyyy" />
								</h:outputText>
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="#{messages['profiles.table.leaving.date']}" />
								</f:facet>
								<h:outputText value="#{item.baja}">
									<s:convertDateTime pattern="dd/MM/yyyy" />
								</h:outputText>
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="#{messages['profiles.table.actions']}" />
								</f:facet>
								<a:commandLink action="#{perfilesAction.editar()}" styleClass="no-border" 
									rendered="#{usuario.perfil.administrador or usuario.perfil.perfilesModificar}" reRender="base">
									<h:graphicImage value="/img/icons/16/edit.png" alt="#{messages['profiles.actions.edit']}" title="#{messages['profiles.actions.edit']}" />
									<f:setPropertyActionListener target="#{perfilesAction.perfil}" value="#{item}" />
								</a:commandLink>
							</rich:column>
						</rich:dataTable>
					</rich:panel>
	
					<rich:datascroller for="profilesTable" align="center"
						selectedStyleClass="border-color-orange color-orange"
						styleClass="top-margin" tableStyleClass="border-color-orange no-bg" />
				</a:outputPanel>
				<a:outputPanel rendered="#{perfilesAction.editarPerfil}">
					<h:outputText value="#{messages['profiles.edit.data']}"
						styleClass="title color-orange" />
					<h:panelGrid styleClass="panel border-color-orange" columns="4">
						
						<h:outputText value="#{messages['profiles.edit.name']}" styleClass="color-orange" />
						<h:inputText value="#{perfilesAction.perfil.nombre}" />
						
						<h:outputText value="#{messages['profiles.edit.registration.date']}" styleClass="color-orange" />
						<rich:calendar value="#{perfilesAction.perfil.alta}" datePattern="dd/MM/yyyy" />
						
						<h:outputText value="#{messages['profiles.edit.leaving.date']}" rendered="#{usuario.perfil.administrador or usuario.perfil.perfilesEliminar}" />
						<rich:calendar value="#{perfilesAction.perfil.baja}" datePattern="dd/MM/yyyy" rendered="#{usuario.perfil.administrador or usuario.perfil.perfilesEliminar}" />
						
					</h:panelGrid>
					<s:div styleClass="clear-it" />
					<h:outputText value="#{messages['profiles.edit.permissions']}"
						styleClass="title color-green" />
					<h:panelGrid styleClass="panel border-color-green" columns="4">
						
						<h:selectBooleanCheckbox id="check_1" value="#{perfilesAction.perfil.usuariosCrear}" />
						<h:outputLabel for="check_1" value="#{messages['profiles.edit.create.users']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_2" value="#{perfilesAction.perfil.usuariosModificar}" />
						<h:outputLabel for="check_2" value="#{messages['profiles.edit.update.users']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_3" value="#{perfilesAction.perfil.usuariosModificarAcceso}" />
						<h:outputLabel for="check_3" value="#{messages['profiles.edit.update.users.access']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_4" value="#{perfilesAction.perfil.usuariosEliminar}" />
						<h:outputLabel for="check_4" value="#{messages['profiles.edit.delete.users']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_5" value="#{perfilesAction.perfil.perfilesCrear}" />
						<h:outputLabel for="check_5" value="#{messages['profiles.edit.create.profiles']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_6" value="#{perfilesAction.perfil.perfilesModificar}" />
						<h:outputLabel for="check_6" value="#{messages['profiles.edit.update.profiles']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_7" value="#{perfilesAction.perfil.perfilesAsignar}" />
						<h:outputLabel for="check_7" value="#{messages['profiles.edit.assign.profiles']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_8" value="#{perfilesAction.perfil.perfilesEliminar}" />
						<h:outputLabel for="check_8" value="#{messages['profiles.edit.delete.profiles']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_9" value="#{perfilesAction.perfil.componentesCrear}" />
						<h:outputLabel for="check_9" value="#{messages['profiles.edit.create.members']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_10" value="#{perfilesAction.perfil.componentesModificar}" />
						<h:outputLabel for="check_10" value="#{messages['profiles.edit.update.members']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_11" value="#{perfilesAction.perfil.componentesEliminar}" />
						<h:outputLabel for="check_11" value="#{messages['profiles.edit.delete.members']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_12" value="#{perfilesAction.perfil.gruposCrear}" />
						<h:outputLabel for="check_12" value="#{messages['profiles.edit.create.bands']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_13" value="#{perfilesAction.perfil.gruposModificar}" />
						<h:outputLabel for="check_13" value="#{messages['profiles.edit.update.bands']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_14" value="#{perfilesAction.perfil.gruposEliminar}" />
						<h:outputLabel for="check_14" value="#{messages['profiles.edit.delete.bands']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_15" value="#{perfilesAction.perfil.reunionesCrear}" />
						<h:outputLabel for="check_15" value="#{messages['profiles.edit.create.meetings']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_16" value="#{perfilesAction.perfil.reunionesModificar}" />
						<h:outputLabel for="check_16" value="#{messages['profiles.edit.update.meetings']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_17" value="#{perfilesAction.perfil.reunionesEliminar}" />
						<h:outputLabel for="check_17" value="#{messages['profiles.edit.delete.meetings']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_18" value="#{perfilesAction.perfil.horasCrear}" />
						<h:outputLabel for="check_18" value="#{messages['profiles.edit.create.timetable']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_19" value="#{perfilesAction.perfil.horasModificar}" />
						<h:outputLabel for="check_19" value="#{messages['profiles.edit.update.timetable']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_20" value="#{perfilesAction.perfil.horasEliminar}" />
						<h:outputLabel for="check_20" value="#{messages['profiles.edit.delete.timetable']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_21" value="#{perfilesAction.perfil.solicitudesVer}" />
						<h:outputLabel for="check_21" value="#{messages['profiles.edit.view.request.access']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_22" value="#{perfilesAction.perfil.solicitudesModificar}" />
						<h:outputLabel for="check_22" value="#{messages['profiles.edit.update.request.access']}" styleClass="color-green" />
						
						<h:selectBooleanCheckbox id="check_23" value="#{perfilesAction.perfil.solicitudesEliminar}" />
						<h:outputLabel for="check_23" value="#{messages['profiles.edit.delete.request.access']}" styleClass="color-green" />
					</h:panelGrid>
				</a:outputPanel>
	
				<div class="clear-it"></div>
			</s:decorate>
			
			<s:decorate template="/layout/buttonbar.xhtml">
				<a:commandButton value="#{messages['profiles.actions.new']}" actionListener="#{perfilesAction.nuevo()}"
					styleClass="btn btn-green" rendered="#{(usuario.perfil.administrador or usuario.perfil.perfilesCrear) and perfilesAction.listarPerfiles}" reRender="base" />
				<a:commandButton value="#{messages['profiles.actions.save']}" actionListener="#{perfilesAction.guardar('profiles.info.save.success')}" styleClass="btn btn-green" 
					rendered="#{(usuario.perfil.administrador or usuario.perfil.perfilesCrear) and perfilesAction.editarPerfil and perfilesAction.perfil.id == null}" reRender="base" />
				<a:commandButton value="#{messages['profiles.actions.save.changes']}" actionListener="#{perfilesAction.guardar('profiles.info.edit.success')}" styleClass="btn btn-green" 
					rendered="#{(usuario.perfil.administrador or usuario.perfil.perfilesModificar) and perfilesAction.editarPerfil and perfilesAction.perfil.id != null}" reRender="base" />
				<a:commandButton value="#{messages['profiles.actions.cancel']}" styleClass="btn btn-orange" reRender="base"
					rendered="#{perfilesAction.editarPerfil}" actionListener="#{perfilesAction.volver()}" />
				<h:commandButton value="#{messages['profiles.actions.back']}"
					action="/menu.htm" styleClass="btn btn-blue" />
			</s:decorate>
		</h:form>
	</ui:define>
	
</ui:composition>
